﻿<script type="text/javascript" src="js/services.js"></script>
<link type="text/css" rel="stylesheet" href="css/services.css"/>
<style type="text/css">
    .filter{
        width: 200px;
        height: 28px;
        overflow: hidden;
        background: url("images/dropdown.png") no-repeat right #ddd;
        border: 0;
        float: right;
        margin-right: 370px;
        margin-bottom: 10px;
    }

    .filter select{
        background: transparent;
        width: 225px;
        line-height: 1;
        padding: 5px;
        border: none;
        border-radius: 1px;
        -webkit-appearance: none;
    }

    #frm_dm{
        margin-top: 10px;
        margin-bottom: 30px;
        padding-bottom: 20px;
    }
</style>
<div class="container">
<script type="text/javascript">
 $(function() {
	$("select[name='info']").change(function(){
		$("form#info").submit();
	});
 });
 </script>
<h1>Thong bao sinh nhat</h1>
	<?php echo form_open(current_url(),"id='info'"); ?>
<span style="display:inline; margin-top: 5px; position: relative; float: left;margin-left:370px;">Sap toi sn 1 </span>
    <div class="filter">
        <?php echo $combobox_cats; ?>
    </div>
<?php echo form_close(); ?>
<div id = "top_reserve">
			<div id = "opt_box">
			</div>
			<div>
				<?php  
                    if( isset( $action )){
                        foreach($action as $a){
                            if( strtolower($a['id']) == 'new'){
                                echo anchor( base_url( ) . $a['url'], $a['label'] );
                                break;
                            }
                        }
                    } 
                        
                ?>
			</div>
		</div>


    <table id="hor-minimalist-b">
	<tr>
	  <?php

                foreach( $rules as $i ){
                    if( in_array( $i[ 'field_id' ], $master_limited  ) )
                        echo "<th>". $i[ 'html' ]."</th>";
                }
            ?>
            <th>Action</th>
	</tr>
	 <?php
                for( $i = 0; $i < count( $results ); $i++ ){
                    echo "<tr>";
                            foreach( $rules as $item ){
                           	    if( $item[ 'field_id' ] != "Image_ID" && in_array( $item[ 'field_id' ], $master_limited ) ){	        
         			                echo "<td>";
									if($item[ 'control' ] == "time")
										echo date("d/m/y",$results[ $i ][ $item[ 'field_id' ] ]);
									else if($item[ 'control' ] == "day")
										echo $results[ $i ][ $item[ 'field_id' ] ]." ngay`";
									else echo $results[ $i ][ $item[ 'field_id' ] ];
            						echo "</td>";					
    					}?>
                         
                        <?php 
                            }
                        echo "<td>";
                            if( isset( $action ) ){
                                foreach($action as $a){
                                    if( strtolower($a['id']) == 'send'){
                                        echo $results[ $i ][ 'send' ] . " ";
                                        break;
                                    }
                                }
                                foreach($action as $a){
                                    if( strtolower($a['id']) == 'delete'){
                                        echo $results[ $i ][ $a['label'] ] . " ";
                                        break;
                                    }
                                }
                            }
                      
                            if( isset( $custom_action ) ){
                                
                                foreach( $custom_action as $item ){
                                //    $a = explode( '=', $item );
                                //    if( isset( $a[ 0 ] ) )
                                        echo $results[$i][$item['action_name']]. "  ";
                                }
                            }
                        echo "</td>";
                    echo "</tr>";
                }
            ?>
				<tr><td colspan="<?php echo count($rules) +1;?>"><center><div class="pagination"><?php echo $this->pagination->create_links(); ?></div></center></td></tr>
	</table>
	
</div>